package Ex1;

import java.util.function.DoubleToIntFunction;

public class Ex3 {
    public static void main(String[] args) {
        confirmResult( 2, 3, 5);
//ax*ax+bx+c


    }

    public static boolean confirmResult(double a,double b, double c) {
        double delta = b * b - 4 * a * c;
        if (delta >= 0) {
            double x1 = (-b + Math.sqrt(delta)) / (2 * a);
            double x2 = (+b - Math.sqrt(delta)) / (2 * a);
            if (delta == 0){
                System.out.println("方程有两个相同的解" + x1);
        }else {
            System.out.println("方程有两个不同的解" + "第一个解为" + x1 + "第二个解为" + x2);
        }
            return true;
        }else {
            System.out.println("方程无解");
            return false;
        }
    }
}
